CREATE EXTERNAL TABLE IF NOT EXISTS spmi_ods.spmi_phone_bill(
id                                                 bigint                         COMMENT '主键ID',
sn                                                 String                         COMMENT '话单序列号',
collect_no                                         String                         COMMENT '汇总批次号',
staff_no                                           String                         COMMENT '员工编号',
staff_name                                         String                         COMMENT '员工名称',
network_id                                         bigint                         COMMENT '网点ID',
network_code                                       String                         COMMENT '网点编号',
network_name                                       String                         COMMENT '网点名称',
agent_network_id                                   bigint                         COMMENT '代理区ID',
agent_network_code                                 String                         COMMENT '代理区编号',
agent_network_name                                 String                         COMMENT '代理区名称',
call_type                                          smallint                       COMMENT '1单呼出2单呼入3呼入呼出（回溯）',
phone_date                                         String                         COMMENT '通话日期',
start_time                                         timestamp                      COMMENT '开始时间',
end_time                                           timestamp                      COMMENT '结束时间',
duration_minutes                                   bigint                         COMMENT '通话时长（分）',
waybill_no                                         String                         COMMENT '运单编号',
unit_price                                         Double                         COMMENT '单价（元）',
call_cost                                          Double                         COMMENT '通话费用（元）',
remark                                             String                         COMMENT '备注',
input_time                                         timestamp                      COMMENT '入库时间',
supplier_name                                      String                         COMMENT '供应商名称',
franchisee_network_id                              bigint                         COMMENT '加盟商网点ID',
franchisee_network_code                            String                         COMMENT '加盟商网点编码',
franchisee_network_name                            String                         COMMENT '加盟商网点名称',
duration_seconds                                   bigint                         COMMENT '通话时长（秒）',
staff_num                                          String                         COMMENT '员工号码',
customer_num                                       String                         COMMENT '客户号码',
prepayment_status                                  smallint                       COMMENT '预付款推送状态，1.成功0.失败',
prepayment_push_num                                bigint                         COMMENT '预付款推送次数',
bill_generation_time                               timestamp                      COMMENT '账单产生时间',
bill_generation_date                               String                         COMMENT '账单产生日期',
last_update_time_sync                              timestamp                      COMMENT '同步ES表时间',
trace_id                                           String                         COMMENT 'TRACEID',
sort                                               smallint                       COMMENT '排序',
version                                            String                         COMMENT '版本号',
bill_push_time                                     timestamp                      COMMENT '消息推送时间'
)
COMMENT '95账单表'
PARTITIONED BY (dt STRING COMMENT '更新/创建日期 (yyyy-MM-dd)')
STORED AS PARQUET
LOCATION '/dw/hive/spmi_ods.db/external/spmi_phone_bill'
TBLPROPERTIES (
  'parquet.column.index.access'='true'
)